#!/usr/bin/env php
<?php

declare(strict_types=1);
/**
 * This file is part of bearing-web.
 *
 * @link     https://www.bearing.cn/
 * @contact  tech@bearing.cn
 * @license  https://gitee.com/cppo/bearing_web/-/blob/master/README.md
 */
use yii\base\InvalidConfigException;
use yii\console\Application;
use yii\helpers\ArrayHelper;

require __DIR__ . '/vendor/autoload.php';

// Environment
require __DIR__ . '/env.php';
require __DIR__ . '/vendor/yiisoft/yii2/Yii.php';
require __DIR__ . '/common/config/bootstrap.php';

$config = ArrayHelper::merge(
    require __DIR__ . '/common/config/main.php',
    require __DIR__ . '/console/config/main.php',
);

try {
    $application = new Application($config);
    $exitCode = $application->run();
    exit($exitCode);
} catch (InvalidConfigException $e) {
    exit($e->getMessage());
}
